import { StatisticType } from "../services/StatisticService";

enum OptionType {
    indicators = 'highcharts-indicators',
    shapeLabel = 'highcharts-label-annotation',
    shapeCircle = 'highcharts-circle-annotation',
    shapeRectangle = 'highcharts-rectangle-annotation',
    line = 'highcharts-infinity-line',
    lineSegment = 'highcharts-segment',
    lineArrowSegment = 'highcharts-arrow-segment',
    lineRay = 'highcharts-ray',
    lineArrowRay = 'highcharts-arrow-ray',
    lineArrow = 'highcharts-arrow-infinity-line',
    lineHorizontal = 'highcharts-horizontal-line',
    lineVertical = 'highcharts-vertical-line',
    elliott3 = 'highcharts-elliott3',
    elliott5 = 'highcharts-elliott5',
    crooked3 = 'highcharts-crooked3',
    crooked5 = 'highcharts-crooked5',
    measureXY = 'highcharts-measure-xy',
    measureX = 'highcharts-measure-x',
    measureY = 'highcharts-measure-y',
    fibonacci = 'highcharts-fibonacci',
    pitchfork = 'highcharts-pitchfork',
    parallel = 'highcharts-parallel-channel',
    counter = 'highcharts-vertical-counter',
    counterLabel = 'highcharts-vertical-label',
    counterArrow = 'highcharts-vertical-arrow',
    flagsCircle = 'highcharts-flag-circlepin',
    flagsDiamond = 'highcharts-flag-diamondpin',
    flagsSquare = 'highcharts-flag-squarepin',
    flagsSimple = 'highcharts-flag-simplepin',
    seriesOhlc = 'highcharts-series-type-ohlc',
    seriesLine = 'highcharts-series-type-line',
    seriesCandlestick = 'highcharts-series-type-candlestick',
    save = 'highcharts-save-chart',
    full = 'highcharts-full',
    zoomX = 'highcharts-zoom-x',
    zoomY = 'highcharts-zoom-y',
    zoomXY = 'highcharts-zoom-xy',
    price = 'highcharts-current-price-indicator',
    toggle = 'highcharts-toggle-annotations'
}


interface ChartOptions {
    id: number;
    label?: string;
    icon: string;
    options: Array<ChartOptionItem>;
    type?: OptionType;
}

interface ChartOptionItem {
    type: OptionType;
    icon: string;
    label?: string;
}

class OhlcData {
    public x: number;
    public open: number;
    public high: number;
    public low: number;
    public close: number;
    constructor(_x: number, _open: number, _high: number, _low: number, _close: number) {
        this.x = _x;
        this.open = _open;
        this.high = _high;
        this.low = _low;
        this.close = _close;
    }
}

class StatisticData {
    public date: number;
    public value: number;
    constructor(_date: number, _value: number,) {
        this.date = _date;
        this.value = _value;
    }
}

class VolumeData {
    public x: number;
    public y: number;
    public color: string;
    constructor(_x: number, _y: number, _color: string) {
        this.x = _x;
        this.y = _y;
        this.color = _color;
    }
}

interface SeriesItem {
    name: string;
    type: string;
    index?: number;
    period?: number;
    extras?: any;
}


class SeriesItem {
    public name: string;
    public type: string;
    public index?: number;
    public period?: number;
    public extras?: any;
    constructor(_name: string, _type: string, _index?: number, _period?: number, _extras: any = {}) {
        this.name = _name;
        this.type = _type;
        this.index = _index;
        this.period = _period;
        this.extras = _extras;
    }
}

interface StatisticTab {
    text: string;
    type: StatisticType;
    tips: Array<string>;

}

interface RangeTab {
    text: string;
    year: number;
}


export { OptionType, OhlcData, VolumeData, SeriesItem, StatisticData };
export type { ChartOptions, ChartOptionItem, RangeTab, StatisticTab };
